<?php /*a:1:{s:60:"D:\workspace\admin\application\admin\view\appface\index.html";i:1747109555;}*/ ?>
<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
    <style>
        .layui-form-item .layui-input-inline {
            width: 150px;
        }

        .layui-form-label {
            padding: 9px 5px;
            width: auto;
        }

        .btn_danger {
            background-color: #FFB800;
        }
    </style>
</head>

<body>
    <div class="layui-fluid">
        <div class="layui-card">
            <div class="layui-form layui-card-header layuiadmin-card-header-auto">
                <form name="formName" onsubmit="return false">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <button class="layui-btn btnOperate" data-type="add">新增渠道映射</button>
                        </div>
                    </div>
                </form>
            </div>


            <div class="layui-card-body">
                <table id="LAY-appface-manage" lay-filter="LAY-appface-manage"></table>
                <script type="text/html" id="table-appaface">
                    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">
                        <i class="layui-icon layui-icon-delete"></i>删除
                    </a>
                </script>
            </div>
        </div>
    </div>
    <script src="/layuiadmin/layui/layui.js"></script>
    <script src="/static/clipboard.min.js"></script>
    <script>
        layui.config({
            base: '/layuiadmin/'
            , version: "<?php echo config('other.ui_version'); ?>"
        }).extend({
            index: 'lib/index' //主入口模块
        }).use(['index', 'table', 'admin'], function () {
            var $ = layui.$
                , form = layui.form
                , table = layui.table
                , admin = layui.admin
                , laydate = layui.laydate;
            // ip统计
            table.render({
                elem: '#LAY-appface-manage'
                , url: '/admin/appface/getlist'
                , cols: [[
                    { field: 'id', title: 'ID', width: 100 }
                    , { field: 'default_channel', title: '源渠道' }
                    , { field: 'default_channel_name', title: '源渠道名' }
                    , { field: 'new_channel', title: '对应渠道' }
                    , { field: 'new_channel_name', title: '对应渠道名' }
                    , {title: '操作', width: '16%', align: 'center', toolbar: '#table-appaface'}
                ]]
                , page: true
                , limit: 20
                , height: 'full-140'
                , text: '对不起，加载出现异常！'
                , even: true
            });
            var active = {
                add: function () {
                    layer.open({
                        type: 2
                        , title: '新增渠道映射'
                        , content: '/admin/appface/add'
                        , maxmin: true
                        , area: ['550px', '500px']
                    });
                },
            };
            $('.layui-btn.btnOperate').on('click', function () {
                var type = $(this).data('type');
                active[type] ? active[type].call(this) : '';
            });  
            table.on('tool', function (obj) {
                if (obj.event === 'del') {
                    layer.confirm('确认删除？', function (index) {
                        admin.req({
                            url: '/admin/appface/del_post'
                            , data: {"id": obj.data.id}
                            , success(res) {
                                if (res.code == 0) {
                                    table.reload('LAY-appface-manage');
                                    layer.msg(res.msg, {icon: 1});
                                } else {
                                    layer.msg(res.msg, {icon: 5});
                                }
                            }
                        });
                    });
                }
            });
        });
   
    </script>
</body>

</html>